import { Suspense, lazy } from "react";

/**
 * Code Splitting
 * 按需加载组件
 * 异步加载一部分代码
 */

const AsyncComponent = lazy(() => import("./memo"));

function CodeSplitting() {
  return (
    <div>
      <h1>React Code Splitting</h1>
      <Suspense fallback={<div>Loading...</div>}>
        <AsyncComponent />
      </Suspense>
    </div>
  );
}

export default CodeSplitting;
